package top.huhuiyu.teachproject.entity.message;

import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import top.huhuiyu.teachproject.validate.TbMessageValidate;

import javax.validation.constraints.NotBlank;
import java.io.Serializable;

/**
 * tb_message表
 *
 * @author 胡辉煜
 */
@TableName(value = "tb_message")
@Data
public class TbMessage implements Serializable {

  private static final long serialVersionUID = 1L;

  @TableId(type = IdType.AUTO)
  private Integer mid;
  @TableField(updateStrategy = FieldStrategy.NEVER)
  private Integer uid;
  @NotBlank(message = "留言标题不能为空", groups = {TbMessageValidate.Add.class, TbMessageValidate.Modify.class})
  @Length(min = 5, max = 100, message = "标题长度必须在5-100之间", groups = {TbMessageValidate.Add.class, TbMessageValidate.Modify.class})
  private String title;
  @NotBlank(message = "留言内容不能为空", groups = {TbMessageValidate.Add.class, TbMessageValidate.Modify.class})
  @Length(min = 30, message = "内容不低于30个字符", groups = {TbMessageValidate.Add.class, TbMessageValidate.Modify.class})
  private String info;
  @TableField(insertStrategy = FieldStrategy.NEVER, updateStrategy = FieldStrategy.NEVER)
  private Integer hits;
  @TableField(insertStrategy = FieldStrategy.NEVER, updateStrategy = FieldStrategy.NEVER)
  private Integer praise;
  @TableField(insertStrategy = FieldStrategy.NEVER, updateStrategy = FieldStrategy.NEVER)
  private Integer reply;
  @TableField(insertStrategy = FieldStrategy.NEVER, updateStrategy = FieldStrategy.NEVER)
  private String reason;
  @TableLogic
  @TableField(insertStrategy = FieldStrategy.NEVER, updateStrategy = FieldStrategy.NEVER)
  private String deleted;
  @TableField(insertStrategy = FieldStrategy.NEVER, updateStrategy = FieldStrategy.NEVER)
  private java.util.Date lastupdate;

}